using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using emp.BLL.SysManage;
using emp.Utility;


public partial class systemmanage_user_user_province : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["uid"] != null)
        {
            hiddne_user_id.Value = Request["uid"].ToString();
        }
        if (Request["UserID"] != null)
        {
            hiddne_user_id.Value = Request["UserID"].ToString();
        }
        if (Request["cur_page"] != null)
        {

            hidden_cur_page.Value = Request["cur_page"].ToString();
        }
        if (Request["MenuID"] != null)
        {
            hidden_menuid.Value = Request["MenuID"].ToString();
        }


        if (Request["pro"] != null)
        {
            pro.Value = Request["pro"].ToString();
            IList list1 = new emp.BLL.BCity().getPVEByName(pro.Value);
            if (list1.Count > 0)
            {
                emp.Model.PCityInfo cif1 = (emp.Model.PCityInfo)list1[0];
                pros.Value = cif1.PVE_ID.ToString();
            }
        }
        if (Request["pros"] != null)
        {
            this.pros.Value = Request["pros"].ToString();
            pro.Value = Request["pros"].ToString();
            IList list = new emp.BLL.BCity().getPVEById(pro.Value);
            if (list.Count > 0)
            {
                emp.Model.PCityInfo cif = (emp.Model.PCityInfo)list[0];
                pro.Value = cif.PEV_NAME;
            }
            
        }
        string[] trme = new string[10];
        trme[0] = hiddne_user_id.Value;
        trme[1] = pro.Value;
        inital(trme);
    }
    

    protected void PageChanged(object sender, GridViewPageEventArgs e)
    {

        gview(e.NewPageIndex);

    }

    private void gview(int page)
    {


        gvquestlist.PageIndex = PageUtil.getGviewNewPage(gvquestlist, page);
        this.pageNum.Value = gvquestlist.PageIndex.ToString();

        IList clist = (IList)Session["SYSTEM_USER_CITY"];

        this.gvquestlist.DataSource = clist;
        this.gvquestlist.DataBind();

        PageUtil.setPageCount(gvquestlist, clist);

    }
    private void inital(string[] trme)
    {
        IList list = new emp.BLL.BCity().getSUC(trme);
        Session["SYSTEM_USER_CITY"] = list;
        this.gvquestlist.DataSource = list;
        this.gvquestlist.DataBind();
    }

    protected void newadd_Click(object sender, EventArgs e)
    {
        string proid ="";
        IList list = new emp.BLL.BCity().getPVEByName(pro.Value);
        emp.Model.PCityInfo cif = new emp.Model.PCityInfo();
        if (list.Count > 0)
        {
            cif = (emp.Model.PCityInfo)list[0];

        }
        proid = cif.PVE_ID.ToString();
        Response.Redirect("city_list.aspx?UserID=" + hiddne_user_id.Value + "&pro=" + proid + "&cur_page=" + hidden_cur_page.Value + "&MenuID=" + hidden_menuid.Value);

    }
    protected void back_Click(object sender, EventArgs e)
    {
         Response.Redirect("user_province.aspx?UserID=" + hiddne_user_id.Value + "&cur_page=" + hidden_cur_page.Value + "&MenuID=" + hidden_menuid.Value);
    }
}
